package com.hack.validator;

import java.util.HashMap;
import java.util.Map;

/**
 * 验证结果类
 * 包含验证结果和错误信息
 *
 * @author hack
 * @version 1.0
 * @date 2025/07/11
 */
public class ValidationResult {
    private boolean valid = true;
    private Map<String, String> errors = new HashMap<>();

    public void addError(String paramPath, String message) {
        valid = false;
        errors.put(paramPath, message);
    }

    public boolean isValid() {
        return valid;
    }

    public Map<String, String> getErrors() {
        return errors;
    }

    @Override
    public String toString() {
        return "ValidationResult{" +
                "valid=" + valid +
                ", errors=" + errors +
                '}';
    }
}